﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Evaluation3;
using Evaluation3.services;

public partial class uicontrol_hoidongNewl : System.Web.UI.UserControl
{
    cucilServices objCucil = new cucilServices();

    #region Page_Load()
    protected void Page_Load(object sender, EventArgs e)
    {
        ResetField();
    }
    #endregion

    #region ResetField()
    public void ResetField()
    {
        txtTenHD.Text = "";
        this.txtNgayThanhLap.Text = DateTime.Now.ToShortDateString();
        txtQuyetDinh.Text = "";
        txtNguoiKy.Text = "";

        Calendar1.Text = DateTime.Now.ToShortDateString();

        lblNotify.Text = "";
        btnThem.Enabled = true;
    }
    #endregion

    #region btnCancel_Click()
    protected void btnCancel_Click(object sender, EventArgs e)
    {
        ResetField();
    }
    #endregion

    #region btnThem_Click()
    protected void btnThem_Click(object sender, EventArgs e)
    {
        try
        {
            objCucil.TenHoiDong = txtTenHD.Text.Trim();
            objCucil.MaDoanhNghiep = int.Parse(Session["CompanyID"].ToString());
            //objCucil.NgayThanhLap = Convert.ToDateTime(txtNgayThanhLap.Text);
            objCucil.NgayThanhLap = DateTime.Parse(Calendar1.getDateTimeValue());
            objCucil.QuyetDinh = txtQuyetDinh.Text.Trim();
            objCucil.NguoiKy = txtNguoiKy.Text.Trim();

            objCucil.HD_TaoMoi();

            lblNotify.Text = "Tạo mới Hội Đồng thành công.";
            btnThem.Enabled = false;
        }
        catch (Exception ex)
        {
            
            throw ex;
        }
    }
    #endregion
}
